from deps.voidsdk.django.modelautocode import models
from deps.voidsdk.pytoolset.enum import Enum


BannerType = Enum((
    (1, "REC_USER_BANNER", "推荐用户横幅"),
    (2, "REC_VIDEO_BANNER", "推荐视频横幅"),
))


class RecBanner(models.Model):
    name = models.CharField("横幅名称", max_length=200)
    pic = models.CharField("横幅图片", max_length=300)
    link = models.CharField("横幅链接", max_length=300)
    t = models.IntegerField("横幅类型", choices=BannerType.choice_tuples())
    order = models.IntegerField("横幅次序", blank=True, default=100)

    create_timestamp = models.DateTimeField("创建时间", auto_now_add=True)
    last_update_timestamp = models.DateTimeField("最后修改时间", auto_now=True)

    def __str__(self):
        return self.name

    class Meta:
        verbose_name = "推荐横幅"
        verbose_name_plural = "推荐横幅"